﻿using System.Collections.Generic;

namespace Yoozoo.Utils
{
    public class DefineSymbolUtils
    {
        public static Dictionary<string, bool> symbolMap = new Dictionary<string, bool>();

        public static void Initialize()
        {
#if DEBUG
            symbolMap["DEBUG"] = true;
#endif

#if GT
            symbolMap["GT"] = true;
#endif

#if YZPD
            symbolMap["YZPD"] = true;
#endif

#if UWA
            symbolMap["UWA"] = true;
#endif

#if EventTrace
            symbolMap["EventTrace"] = true;
#endif

#if ENABLE_HYBRID_CLR
            symbolMap["ENABLE_HYBRID_CLR"] = true;
#endif

#if ENABLE_LOG
            symbolMap["ENABLE_LOG"] = true;
#endif

#if ENABLE_DEBUG_LOG
            symbolMap["ENABLE_DEBUG_LOG"] = true;
#endif

#if ENABLE_DEBUG_AND_ABOVE_LOG
            symbolMap["ENABLE_DEBUG_AND_ABOVE_LOG"] = true;
#endif

#if ENABLE_INFO_LOG
            symbolMap["ENABLE_INFO_LOG"] = true;
#endif

#if ENABLE_INFO_AND_ABOVE_LOG
            symbolMap["ENABLE_INFO_AND_ABOVE_LOG"] = true;
#endif

#if ENABLE_WARNING_LOG
            symbolMap["ENABLE_WARNING_LOG"] = true;
#endif

#if ENABLE_WARNING_AND_ABOVE_LOG
            symbolMap["ENABLE_WARNING_AND_ABOVE_LOG"] = true;
#endif

#if ENABLE_WARNING_LOG
            symbolMap["ENABLE_WARNING_LOG"] = true;
#endif

#if ENABLE_WARNING_AND_ABOVE_LOG
            symbolMap["ENABLE_WARNING_AND_ABOVE_LOG"] = true;
#endif

#if ENABLE_ERROR_LOG
            symbolMap["ENABLE_ERROR_LOG"] = true;
#endif

#if ENABLE_ERROR_AND_ABOVE_LOG
            symbolMap["ENABLE_ERROR_AND_ABOVE_LOG"] = true;
#endif

#if XLua
            symbolMap["XLua"] = true;
#endif

#if NO_PACKAGE
            symbolMap["NO_PACKAGE"] = true;
#endif

#if USE_LUA
            symbolMap["USE_LUA"] = true;
#endif

#if UPR_LUA_PROFILER
            symbolMap["UPR_LUA_PROFILER"] = true;
#endif

#if ENABLE_ONGUI_EDITOR
            symbolMap["ENABLE_ONGUI_EDITOR"] = true;
#endif

#if ENABLE_ONGUI_RUNTIME
            symbolMap["ENABLE_ONGUI_RUNTIME"] = true;
#endif

#if ASTAR_NO_GUI
            symbolMap["ASTAR_NO_GUI"] = true;
#endif
        }

        public static bool IsDefineSymbol(string symbolName)
        {
            if (symbolMap.TryGetValue(symbolName, out bool isDefined))
            {
                return isDefined;
            }

            return false;
        }

        public static void DumpAllSymbols()
        {
            foreach (var pair in symbolMap)
            {
                UnityEngine.Debug.LogFormat("DefineSymbol: {0} {1}", pair.Key, pair.Value);
            }
        }
    }
}
